<?php


namespace App\Validate\Logic;

use App\Exceptions\SysExceptions;
use App\Validate\ImagesValidate;

/**
 * Class ImagesLogic
 * @package App\Validate\Logic
 * author:fhc
 * desc:轮播图验证器
 * created_at: 2020/11/20 - 4:29 下午
 */
class ImagesLogic extends BaseLogic
{
    /**
     * @return ImagesValidate
     * author:fhc
     * desc:获取验证器
     * created_at: 2020/11/20 - 4:29 下午
     */
    private function getValidate():ImagesValidate{
        return  new ImagesValidate;
    }


    /**
     * author:fhc
     * desc:添加
     * created_at: 2020/11/20 - 4:29 下午
     * @param array $params
     * @throws SysExceptions
     */
    public function add($params = []){
        $validate = $this->getValidate();
        if(!$validate->scene('add')->check($params)){
            $this->error($validate->getError());
        }
    }

    /**
     * @param array $all
     * author:fhc
     * desc:修改
     * created_at: 2020/11/20 - 8:06 下午
     * @throws SysExceptions
     */
    public function update(array $all)
    {
        $validate = $this->getValidate();
        if(!$validate->scene('update')->check($all)){
            $this->error($validate->getError());
        }
    }

}
